NormalizedLCS

Implements a normalized metric based on the Longest Common Subsequence distance (Yujian & Bo, 2007).

The normalized LCS distance between Strings \(X\) and \(Y\) is: \(\frac{2 \times distance_{LCS}(X, Y)}{\lvert X \rvert + \lvert Y \rvert + distance_{LCS}(X, Y)}\), where \(GLD(X, Y)\) is the non-normalized LCS distance.

The similarity is computed as \(1.0 - distance(X, Y)\).

References

Yujian, L., & Bo, L. (2007-06). A normalized levenshtein distance metric. IEEE Transactions on Pattern Analysis and Machine Intelligence, 29(6), 1091-1095. https://doi.org/10.1109/tpami.2007.1078[sci-hub]

Author

solonovamax

See also

Functions

Link copied to clipboard
open override fun distance(s1: String, s2: String): Double

Compute and return the metric distance.

Link copied to clipboard
open override fun similarity(s1: String, s2: String): Double

Computes the similarity of two strings. The similarity will be normalized using the number of operations that are performed.